package reflect;

import java.util.Arrays;

/**
 * JDK5之后推出了一个特性:变长参数
 */
public class ArgsDemo {
    public static void main(String[] args) {
        //dosome(new String[]{})
        dosome(1);
        dosome(2,"one");
        dosome(3,"one","two");
        //dosome(new String[]{"one","two","two","two","two","two","two","two","two","two","two"});
        dosome(4,"one","two","two","two","two","two","two","two","two","two","two");
    }

    /**
     * 边长参数要求必须是方法的最后一个参数
     */
    public static void dosome(int age,String... s){
//  public static void dosome(String[] s){
        System.out.println(s.length);
        System.out.println(Arrays.toString(s));
    }
}
